package com.dxy.df.core.assit;

import com.dxy.df.core.model.BasicQuery;
import com.dxy.df.core.model.PageRs;
import com.dxy.df.core.model.Paging;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author : wangsheng@dxy.cn
 * @date 2019-02-14
 **/
@Component
public class SearchHandler {


    public <V> PageRs search(List<V> voList, int total, BasicQuery query) {
        Paging paging = new Paging(total, query.getLimit(), query.getPage());
        return PageRs.ok(paging, voList);
    }

    public <V> PageRs search(List<V> voList, int total, int limit, int page) {
        Paging paging = new Paging(total, limit, page);
        return PageRs.ok(paging, voList);
    }
}
